/**
 * @ClassName TreeNode
 * @Description TreeNode 树类
 * @Author clockTown
 * @Date 2021/8/17 9:13
 * @Version 1.0
 */
public class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;

    TreeNode(int x) {
        val = x;
    }
    public static TreeNode array2TreeNode(Integer []array, int index)
    {
        TreeNode tn = null;
        if (index<array.length) {
            Integer value = array[index];
            if (value == null) {
                return null;
            }
            tn = new TreeNode(value);
            tn.left = array2TreeNode(array, 2*index+1);
            tn.right = array2TreeNode(array, 2*index+2);
            return tn;
        }
        return tn;
    }
}
